//
//  GetTagListApi.m
//  EMMApp
//
//  Created by qiaofangMac on 2018/1/24.
//  Copyright © 2018年 YiXun. All rights reserved.
//

#import "GetTagListApi.h"
#define myUrlMethod @"getTagList"
#define myUrlPath @"/appapi/getTagList"

@implementation GetTagListApi
{
    NSString *_body;
}
- (instancetype)initWith {
    self = [super init];
    if (self) {
        NSMutableDictionary *params = [NSMutableDictionary dictionary];
        [params setValue:@"" forKey:@"version"];
        [params setValue:@"" forKey:@"token"];
        [params setValue:@"" forKey:@"sign"];
        _body = [@{@"params" : params} JSONString];
        NSLog(@"%@:\n %@%@?body=%@", myUrlMethod, apiBaseUrl, myUrlPath, _body);
    }
    return self;
}

#pragma mark - 父类继承拓展

- (NSString *)requestUrl
{
    return myUrlPath;
}

- (id)requestArgument
{
    return @{ @"body" : _body };
}

- (NSString *)methodString
{
    return myUrlMethod;
}


#pragma mark - 通用

- (GetTagList *)resultData
{
    id myObj = [IDTools jsonStrToObjc:self.responseString method:myUrlMethod];
    
    GetTagList *data = (GetTagList *)myObj;
    
    NSLog(@"%@ resultData is %@", myUrlMethod, data);
    
    return data;
}

- (BOOL)isSuccess
{
    NSString *str = [[self resultData] result];
    if ([NSString isStringEmpty:str] || ![str isEqualToString:@"1"]) {
        return NO;
    } else {
        return YES;
    }
}
@end
